<html>
<head><meta charset="utf-8"><title>PlaceBase removal · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html">PlaceBase removal</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="183360741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/183360741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#183360741">(Dec 13 2019 at 13:57)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> this <a href="https://github.com/rust-lang/rust/issues/67000" target="_blank" title="https://github.com/rust-lang/rust/issues/67000">#67000</a> is now ready</p>



<a name="183360761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/183360761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#183360761">(Dec 13 2019 at 13:57)</a>:</h4>
<p>it sits on top of <a href="https://github.com/rust-lang/rust/issues/67192" target="_blank" title="https://github.com/rust-lang/rust/issues/67192">#67192</a></p>



<a name="183360828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/183360828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#183360828">(Dec 13 2019 at 13:58)</a>:</h4>
<p>which you were discussing with <span class="user-mention" data-user-id="120791">@RalfJ</span></p>



<a name="183360893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/183360893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#183360893">(Dec 13 2019 at 13:59)</a>:</h4>
<p>I need to check that PR again but at some point saw that <span class="user-mention" data-user-id="120791">@RalfJ</span> was asking for some motivation about the PR, well if it helps a bit <a href="https://github.com/rust-lang/rust/issues/67000" target="_blank" title="https://github.com/rust-lang/rust/issues/67000">#67000</a> is part of the motivation <span aria-label="smile" class="emoji emoji-263a" role="img" title="smile">:smile:</span></p>



<a name="183361356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/183361356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#183361356">(Dec 13 2019 at 14:05)</a>:</h4>
<p>So the problem with <a href="https://github.com/rust-lang/rust/issues/67000" target="_blank" title="https://github.com/rust-lang/rust/issues/67000">#67000</a> is that since we now make all promoteds essentially <code>let tmp = promoted; &amp;tmp</code>, the addr-of-zst-promoted-becomes-integer-pointer logic in codegen isn't triggered anymore, thus causing test failures where we compare the address <code>&amp;()</code> with <code>1</code>. While we could fix this just in codegen, this would severely complicate codegen, and also cause the weird situation where <code>assert!(&amp;() as *const () as usize == 1)</code> fails at compile-time but works at runtime</p>



<a name="184060744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184060744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184060744">(Dec 22 2019 at 16:35)</a>:</h4>
<p>I am questioning those tests, Is there an RFC/FCP that we guarantee the address of temporary 1-ZSTs to be 1?</p>



<a name="184066382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184066382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184066382">(Dec 22 2019 at 19:32)</a>:</h4>
<p>nope</p>



<a name="184066387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184066387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184066387">(Dec 22 2019 at 19:32)</a>:</h4>
<p>should we just brick them all?</p>



<a name="184099123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184099123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184099123">(Dec 23 2019 at 11:42)</a>:</h4>
<p>Hmm, interesting</p>



<a name="184099161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184099161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184099161">(Dec 23 2019 at 11:43)</a>:</h4>
<p>I'm trying to remember. I certainly don't recall <em>guaranteeing</em> the address of a ZST to be anything other than "not null"</p>



<a name="184099312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184099312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184099312">(Dec 23 2019 at 11:47)</a>:</h4>
<p>we don't afaict, but we have done some work to make the addresses whatever <code>std::ptr::dangling</code> returns: <a href="https://github.com/rust-lang/rust/pull/62487" target="_blank" title="https://github.com/rust-lang/rust/pull/62487">https://github.com/rust-lang/rust/pull/62487</a></p>



<a name="184100221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184100221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184100221">(Dec 23 2019 at 12:09)</a>:</h4>
<p>Yeah, I had a vague memory of that</p>



<a name="184100232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184100232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184100232">(Dec 23 2019 at 12:09)</a>:</h4>
<p>We should I guess clarify exactly <em>what</em> we are specifying; there may be de facto reliance on <code>dangling</code></p>



<a name="184100284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184100284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184100284">(Dec 23 2019 at 12:10)</a>:</h4>
<p>( cc <span class="user-mention" data-user-id="125270">@scottmcm</span> )</p>



<a name="184100291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184100291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184100291">(Dec 23 2019 at 12:10)</a>:</h4>
<p>but I didn't interpret that PR as any form of "guarantee" for sure</p>



<a name="184100301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184100301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184100301">(Dec 23 2019 at 12:10)</a>:</h4>
<p>I didnt' <em>quite</em> understand where the various perf/compiler wins came from there, I guess maybe it had more to do with however we were compiling things before..?</p>



<a name="184103097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184103097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184103097">(Dec 23 2019 at 13:10)</a>:</h4>
<p>the perf wins came from llvm not creating allocations</p>



<a name="184103382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PlaceBase%20removal/near/184103382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PlaceBase.20removal.html#184103382">(Dec 23 2019 at 13:14)</a>:</h4>
<p>I don't think any code <em>can</em> be relying on it, because <code>let x: [i32; 0] = []; let y = &amp;[x]</code> will not give <code>y</code> a dangling address</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>